/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a1227
 * Date: 2022-07-25
 * Time: 11:11
 */
public class DoubleLinkedList {
    public static void main(String[] args) {
        //new一个双向链表
        MyLinkedList myLinkedList = new MyLinkedList();
        //头插
        /*myLinkedList.addFirst(1);
        myLinkedList.addFirst(2);
        myLinkedList.addFirst(3);
        myLinkedList.addFirst(4);
        myLinkedList.addFirst(5);*/
        //打印输出
        //myLinkedList.display();
        //尾插
        myLinkedList.addLast(1);
        myLinkedList.addLast(2);
        myLinkedList.addLast(3);
        myLinkedList.addLast(4);
        myLinkedList.addLast(5);
        //打印输出
        myLinkedList.display();
        //任意位置插入元素
        //myLinkedList.addIndex(5,6);
        //打印输出
        //myLinkedList.display();
        //判断双向链表中是否存在key
        //System.out.println(myLinkedList.contains(0));
        //删除第一次出现的关键字key
        //myLinkedList.remove(3);
        //打印输出
        //myLinkedList.display();
        //删除所有值为key的节点
        //myLinkedList.removeAllKey(1);
        //打印输出
        //myLinkedList.display();
    }
}
